<template>
	<div class="box">
		<el-container class="container">
			<el-header>
				<span style="float: left;">欢迎管理员</span>
				<span class="layout" @click="layout()">退出登录</span>
			</el-header>
			<el-container>
				<el-aside>
					<el-menu background-color="#D3DCE6" router>
						<el-submenu index="1">
							<template slot="title">
								<i class="el-icon-location"></i>
								<span>用户</span>
							</template>
							<el-menu-item index="/admin/user">用户列表</el-menu-item>
							<el-menu-item index="/admin/adduser">添加用户</el-menu-item>
						</el-submenu>
						
						<el-submenu index="2">
							<template slot="title">
								<i class="el-icon-location"></i>
								<span>视频</span>
							</template>
							<el-menu-item index="/admin/video">视频列表</el-menu-item>
							<el-menu-item index="/admin/addvideo">添加视频</el-menu-item>
						</el-submenu>
						
						<el-submenu index="3">
							<template slot="title">
								<i class="el-icon-location"></i>
								<span>轮播图</span>
							</template>
							<el-menu-item index="/admin/carousel">轮播图列表</el-menu-item>
							<el-menu-item index="/admin/addcarousel">添加轮播图</el-menu-item>
						</el-submenu>
						
					</el-menu>
				</el-aside>

				<el-main>
					<router-view></router-view>
				</el-main>
			</el-container>

		</el-container>
	</div>
</template>

<script>
	export default {
		methods: {
			layout() {
				let url = "layout/"+window.sessionStorage.getItem("token");
				this.$http.get(url).then(res => {
					if(res.data.status == 2000){
						window.sessionStorage.clear();
						this.$router.push("/");
					}
				})
			}
		}
	}
</script>

<style>
	.el-header {
		background-color: #B3C0D1;
		color: #333;
		text-align: center;
		line-height: 60px;
	}

	.el-aside {
		background-color: #D3DCE6;
		color: #333;
		text-align: center;
		line-height: 200px;
	}

	.el-main {
		background-color: #E9EEF3;
		color: #333;
		text-align: center;
	}
	.container {
		height: 650px;
	}
	.layout {
		float: right;
	}
</style>
